Skip to content

[C++] Skip the OTF var data length prefix check for var data absent at the acting version - #1186

Open
slachiewicz wants to merge 1 commit into
aeron-io:masterfrom
slachiewicz:cpp-otf-absent-var-data-length-check
Open

slachiewicz wants to merge 1 commit into
aeron-io:masterfrom
slachiewicz:cpp-otf-absent-var-data-length-check

Conversation

@slachiewicz

Copy link
Copy Markdown
Contributor

OtfMessageDecoder::decodeData checked that a var data length prefix fits in the buffer even for a var data field added after the acting version, which has no prefix on the wire. A valid older-version message that ends where that field would start was rejected with "length too short for data length field".

The check now applies only to var data present at the acting version. Absent var data is still reported to onVarData with length 0, as the Java OtfMessageDecoder does. This is a correctness fix, not a bounds fix.

Part of #969.

Verified: OtfAbsentVarDataTest fails on master (decoding a version 0 AddVarDataV1 throws) and passes here; sbe-tool checkstyle and test, cppbuild and cppbuild --debug-build --sanitise-build pass.

…t the acting version.

An absent var data field has no length prefix on the wire, so the check must stay behind isPresent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant